<?php include "../public/header.php";?>
<?php include "../public/header_edit.php";?>
<body>
    <form class="layui-form layui-form-pane" id="operatePage">
        <div class="page-title">
            <div class="page-title-con">
                <span>取证</span>
                <div class="move_title"></div>
                <?php include "../public/sub.php";?>
            </div>
        </div>

        <div class="main-container">
            <div class="block-generic">
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12">
                            <label class="layui-form-label">领取方式</label>
                            <div class="layui-input-block">
                                <input type="text" id="lingtype_name" readonly placeholder="请输入" autocomplete="off" class="layui-input readonly">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item lingtype1 layui-hide">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12">
                            <label class="layui-form-label">收件信息</label>
                            <div class="layui-input-block">
                                <input type="text" id="shou" readonly placeholder="请输入" autocomplete="off" class="layui-input readonly">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item lingtype1 layui-hide">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12">
                            <label class="layui-form-label">寄件信息</label>
                            <div class="layui-input-block">
                                <input type="text" name="youji" id="youji" placeholder="请输入" clearable  autocomplete="off" class="layui-input">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12">
                            <label class="layui-form-label">自取时间</label>
                            <div class="layui-input-block">
                                <input type="text" name="qudt" id="qudt" readonly placeholder="请选择" clearable  autocomplete="off" class="layui-input bdate_ymd">
                            </div>
                        </div>
                    </div>
                </div>
                <div class="layui-form-item height_auto">
                    <div class="layui-row layui-col-space10">
                        <div class="layui-col-md12" >
                            <label class="layui-form-label label_textarea">备注</label>
                            <div class="layui-input-block">
                                <textarea id="explain_qu" name="explain_qu" placeholder="请输入" class="layui-textarea"></textarea>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

        </div>
    </form>
    <script>
        var param_id = getQueryVariable('id') || 0;



        layui.use(['laytp', 'form'], function() {
            var form = layui.form, layer = layui.layer;
            render_input_attr();
            facade.ajax({type: 'get', url: ask_cert_borrow_qu, data:{id: param_id}}).done(function(res){
                if (res.code === 2000) {
                    var data = res.data.data;
                    $("#lingtype_name").val(data.lingtype_name);
                    $("#shou").val(data.shou);
                    $("#youji").val(data.youji);
                    $("#qudt").val(data.qudt);
                    $("#explain_qu").val(data.explain_qu);

                    if(data.lingtype == 1){
                        $(".lingtype1").removeClass('layui-hide');
                    }

                    render_date();
                    render_from();
                }
            });




            form.on('submit(add)', function(data){
                var validRes = $("#operatePage").valid();
                if(!validRes){return false;}

                data.field.id = param_id;
                facade.ajax({url: ask_cert_borrow_qu, data:data.field}).done(function(res){
                    if (res.code === 2000) {
                        dataPostTimeOut();
                    }
                });

                return false;
            });

        });

    </script>
</body>
</html>
